// api.js
import {
	request
} from '@/utils/request.js'; // 引入封装好的request.js
//登录
export const weChatPhoneLogin = (data) => {
	return request({
		url: '/login/weChatPhoneLogin',
		method: 'POST',
		data: data,
	});
};
//静默授权
export const getSilent = (pid) => {
	return request({
		url: `/user/weChat_silent_authorization/${pid}`, // 使用模板字符串并正确插入 id
		method: 'GET',
	});
};
//获取oss
export const getOssSecretKey = () => {
	return request({
		url: '/aliyun/get_oss_secret_key',
		method: 'GET',
	});
};
//邀请用户
export const invitationRecord = (data) => {
	return request({
		url: '/invitation_record/save',
		method: 'POST',
		data: data,
	});
};
//获取用户信息
export const getUserInfo = () => {
	return request({
		url: '/user/getUserInfo',
		method: 'GET',
	});
};
//修改用户信息
export const editUserInfo = (data) => {
	return request({
		url: '/user/updateById',
		method: 'POST',
		data: data,
	});
};
//获取收藏列表
export const getCollect = (data) => {
	return request({
		url: '/commodity_collect/getPage',
		method: 'POST',
		data: data,
	});
};
//清空收藏列表
export const delAll = (data) => {
	return request({
		url: '/commodity_collect/removeByCondition',
		method: 'POST',
		data: data,
	});
};
//根据ids删除收藏
export const delCollectIds = (ids) => {
	return request({
		url: `/commodity_collect/removeBathByIds/${ids}`, // 使用模板字符串并正确插入 id
		method: 'GET',
	});
};
//浏览记录列表
export const getBrowsing = (data) => {
	return request({
		url: '/commodity_browsing_history/getPage',
		method: 'POST',
		data: data,
	});
};
//根据ids删除浏览记录
export const delBrowsing = (ids) => {
	return request({
		url: `/commodity_browsing_history/removeBathByIds/${ids}`, // 使用模板字符串并正确插入 id
		method: 'GET',
	});
};

//清空浏览记录
export const delAllBrowsing = (data) => {
	return request({
		url: '/commodity_browsing_history/removeByCondition',
		method: 'POST',
		data: data,
	});
};
//我的团队
export const getTeamLevel = (data) => {
	return request({
		url: '/invitation_record/getPage',
		method: 'POST',
		data: data,
	});
};
//获取用户是否下过单 
export const getIsBuyCommodity = () => {
	return request({
		url: '/commodity/isBuyCommodity',
		method: 'get',
	});
};
//获取设置
export const getConfig = (data) => {
	return request({
		url: '/distribution_config/getPage',
		method: 'POST',
		data: data,
	});
};
